import models.Entities;
import models.IdeaDeveloper;
import models.Organization;
import models.OrganizationLead;
import models.Topic;
import models.TopicRelation;

import org.junit.Test;

import play.test.UnitTest;

public class TarekAka3ammo extends UnitTest {
	@Test
	public void TopicRelation() {

		IdeaDeveloper ideaDeveloper1 = new IdeaDeveloper("AmiraAli ",
				"Amira Elshimy", "123456", "amira@guc.edu.eg", "17/8/1991",
				"lalal");
		ideaDeveloper1.save();
		Organization org1 = new Organization();
		org1.save();
		OrganizationLead orgLead1 = OrganizationLead.create(ideaDeveloper1);
		org1.creator = orgLead1;
		org1.save();
		Topic topic1 = Topic.createTopicOrg("yarab", "yamosahel", org1.id,
				ideaDeveloper1.id);
		Topic topic2 = Topic.createTopicOrg("aaa", "ss", org1.id,
				ideaDeveloper1.id);
		// Topic relation delete test
		TopicRelation topicrelation = new TopicRelation();
		topicrelation.MakeTopicRelation(topic1.id, topic2.id, "vs", "sadasd");
		topicrelation.save();
		assertEquals("Relation is done !", topicrelation.MakeTopicRelation(
				topic1.id, topic2.id, "manges", "sadasd"));
		assertEquals("Deleted!",
				TopicRelation.DelteRelationsTopics(topicrelation.id));
		// Topic lock test

		assertEquals("done LOCK", topic1.lockTopic(topic1.id));
		assertEquals("done UNLOCK", topic1.unlockTopic(topic1.id));
		// entity lock test
		Organization organization2 = Organization.create(ideaDeveloper1, "C2",
				"C2s organization", "public");
		organization2.save();
		Entities entity2 = organization2.addEntitiyReturn("C2s Entity",
				ideaDeveloper1);
		organization2.save();
		entity2.save();

		assertEquals("done LOCK", entity2.lockEntity(entity2.id));
		assertEquals("done UNLOCK", entity2.unlockEntity(entity2.id));

	}
}
